package cn.luckdou.system.model.we_chat_location;

import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.util.Map;

/**
 * <p>
 * 微信用户位置
 * </p>
 *
 * @author Dadou
 * @since 2017-12-07
 */
@TableName("tb_we_chat_location")
public class WeChatLocation extends Model<WeChatLocation> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
	@TableId(value="id", type= IdType.AUTO)
	private Long id;
    /**
     * openId
     */
	@TableField("open_id")
	private String openId;
    /**
     * 纬度
     */
	private String latitude;
    /**
     * 经度
     */
	private String longitude;
    /**
     * 精度
     */
	private String precision;
    /**
     * 坐标地址
     */
	private String lable;
    /**
     * 状态 1正常 0停用
     */
	private Integer status;
    /**
     * 创建时间
     */
	@TableField("created_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date createdTime;
    /**
     * 修改时间
     */
	@TableField("updated_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date updatedTime;
    /**
     * 删除时间
     */
	@TableField("deleted_time")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date deletedTime;
    /**
     * 编辑人
     */
	@TableField("created_editor")
	private String createdEditor;
    /**
     * 更新人
     */
	@TableField("updated_editor")
	private String updatedEditor;
	/**
	 * 无参构造方法
     */
	public WeChatLocation(){
	}

	public WeChatLocation(Map<String, String> map){
		this.openId=map.get("FromUserName");
		this.latitude=map.get("Latitude");
		this.longitude=map.get("Longitude");
		this.precision=map.get("Precision");

		this.createdTime=new Date(Long.parseLong(map.get("CreateTime"))*1000);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId =StringUtils.isNotBlank(openId)?openId:null;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude =StringUtils.isNotBlank(latitude)?latitude:null;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude =StringUtils.isNotBlank(longitude)?longitude:null;
	}

	public String getPrecision() {
		return precision;
	}

	public void setPrecision(String precision) {
		this.precision =StringUtils.isNotBlank(precision)?precision:null;
	}

	public String getLable() {
		return lable;
	}

	public void setLable(String lable) {
		this.lable =StringUtils.isNotBlank(lable)?lable:null;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Date getUpdatedTime() {
		return updatedTime;
	}

	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}

	public Date getDeletedTime() {
		return deletedTime;
	}

	public void setDeletedTime(Date deletedTime) {
		this.deletedTime = deletedTime;
	}

	public String getCreatedEditor() {
		return createdEditor;
	}

	public void setCreatedEditor(String createdEditor) {
		this.createdEditor =StringUtils.isNotBlank(createdEditor)?createdEditor:null;
	}

	public String getUpdatedEditor() {
		return updatedEditor;
	}

	public void setUpdatedEditor(String updatedEditor) {
		this.updatedEditor =StringUtils.isNotBlank(updatedEditor)?updatedEditor:null;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}
